//
// Created by shen on 2024/12/18.
//

#ifndef AEDIT_FFPLAYER_H
#define AEDIT_FFPLAYER_H


#include "JavaCallHelper.h"
#include "FFStatus.h"
#include "thread"
#include "log.h"
#include "VideoDecoder.h"
extern "C" {
#include "libavformat/avformat.h"
};
    class FFPlayer {
public:
    FFPlayer(JavaCallHelper *_helper, const char *_url,FFStatus  *ffStatus);

    virtual ~FFPlayer();
    int getAVCodecContext(AVCodecParameters *avCodecParameters,AVCodecContext **avCodecContext);
    void setVolume(int volume);
    void start();
    void decodeFFmpegThread();
    void prepared();
    void setIsFramePreview(bool isFramePreview);
    public:
        VideoDecoder *videoDecoder= nullptr;
    public:

    std::thread decodeThread;
    bool exit = false;
    JavaCallHelper *helper = nullptr;
    const char *url= nullptr;
    FFStatus *ffStatus;

        int tempIndex = 0;
    AVFormatContext *avFormatContext = NULL;
};


#endif //AEDIT_FFPLAYER_H
